import './App.css'
import {Tldraw,} from 'tldraw'
import 'tldraw/tldraw.css'
import {useRef} from "react";
import {useFocusAnyEditor} from "./FocusAnyEditor.ts";

function App() {
    const editorRef = useRef(null);
    const handleMount = (editor: any) => {
        if (editorRef.current) {
            return
        }
        editorRef.current = editor;
        // eslint-disable-next-line react-hooks/rules-of-hooks
        useFocusAnyEditor({editor});
        // setTimeout(() => {
        //     // @ts-ignore
        //     window.editorGetContent(console.log,null)
        //     // @ts-ignore
        //     window.editorSetContent(null,null,null)
        // }, 5000)
    }
    return (
        <>
            <div style={{position: 'fixed', inset: 0}}>
                <Tldraw onMount={handleMount}/>
            </div>
        </>
    )
}

export default App
